<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
namespace Home\Controller;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class ConfigController extends HomeController
{

    function _initialize()
    {}

    public function index()
    {
        if (IS_POST) {
            foreach ($addon['config'] as $k => $vv) {
                if ($vv['type'] == 'material') {
                    $_POST['config'][$k] = $_POST[$k];
                }
            }
            $flag = D('Common/AddonConfig')->set(_ADDONS, I('config'));
            
            if ($flag !== false) {
                $this->success('保存成功', Cookie('__forward__'));
            } else {
                $this->error('保存失败');
            }
        }
        
        $this->display();
    }
}